<?php

namespace App\Request\Report;

use App\Request\BaseCommonRequest;
use Hyperf\Context\Context;
use Hyperf\Validation\Request\FormRequest;

class SuggestCreateRequest extends BaseCommonRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'content' => 'required',
            'contact' => 'required',
            // 'from' => 'required',
            // 'version_code' => 'required',
            // 'channel' => 'required',
        ];
    }

    /**
     * 获取已定义验证规则的错误消息
     */
    public function messages(): array
    {
        $language = Context::get('language');
        if ($language == 'zh-zn') {
            return [
                'content.required' => '内容不能为空',
                'contact.required' => '联系方式不能为空',
                // 'from.required' => '系统类型不能为空',
                // 'version_code.required' => '版本号不能为空',
                // 'channel.required' => '渠道不能为空',
            ];
        } elseif ($language == 'zh-hk') {
            return [
                'content.required' => '內容不得為空',
                'contact.required' => '聯繫方式不得為空',
                // 'from.required' => '系統類型不得為空',
                // 'version_code.required' => '版本號碼不得為空',
                // 'channel.required' => '頻道不得為空',
            ];
        } else {
            return [
                'content.required' => 'Content cannot be empty',
                'contact.required' => 'Contact information cannot be empty',
                // 'from.required' => 'System Type cannot be empty',
                // 'version_code.required' => 'Version number cannot be empty',
                // 'channel.required' => 'Channel cannot be empty',
            ];
        }

    }


}